home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Champak 31
/
Volume 31 - JOGO DISK .iso
/
Games
/
christmas_attack.swf
/
scripts
/
DefineSprite_170_swarm3
/
frame_1
/
PlaceObject2_169_1
/
CLIPACTIONRECORD onClipEvent(enterFrame).as
Wrap
Text File
|
2007-01-15
|
1KB
|
42 lines
onClipEvent(enterFrame){
if(_root.pause == 0)
{
targetVectorX = 320 - _parent._x;
targetVectorY = 0;
hypVector = Math.sqrt(targetVectorX * targetVectorX + targetVectorY * targetVectorY);
targetThetaX = Math.asin(targetVectorX / hypVector) / 0.017453292519943295;
targetThetaY = Math.acos(targetVectorY / hypVector) / 0.017453292519943295;
if(targetVectorY < 0)
{
targetTheta = 180 - targetThetaX;
}
else
{
targetTheta = targetThetaX;
}
if(Math.abs(targetTheta - rota) < 10 || Math.abs(targetTheta - rota) > 350)
{
rota = targetTheta;
turning = 0;
}
if(rota < targetTheta)
{
if(turning < turnSpeed)
{
turning++;
}
}
else if(rota > targetTheta)
{
if(turning > - turnSpeed)
{
turning--;
}
}
rota += turning;
xSpeed += accel * Math.sin(rota * 3.141592653589793 / 180);
xSpeed /= spdx;
_parent._x += xSpeed;
}
}